package com.zan.pattern.decorator;

/**
 * @Author Zan
 * @Create 2024-04-25 23:30
 * @Description : TODO(请用一句话描述一下)
 * @ClassName: Client
 */
public class Client {
    public static void main(String[] args) {
        // 点一份炒饭
        FastFood food = new FriedRice();
        // 计算价格
        System.out.println(food.getDesc() + " " + food.cost() + "元");

        System.out.println("======================");

        // 在上面的炒饭中加一个鸡蛋
        food = new Egg(food);
        System.out.println(food.getDesc() + " " + food.cost() + "元");

        System.out.println("======================");

        // 在加一个鸡蛋
        food = new Egg(food);
        System.out.println(food.getDesc() + " " + food.cost() + "元");

        System.out.println("======================");

        // 加一个培根
        food = new Bacon(food);
        System.out.println(food.getDesc() + " " + food.cost() + "元");
    }
}
